# Maintainer: Sven-Hendrik Haase <svenstaro@archlinux.org>
# Contributor: SaultDon <sault.don gmail>
pkgname=pdal
pkgver=2.5.3
pkgrel=1
pkgdesc="A C++ library for translating and manipulating point cloud data"
arch=('loong64' 'x86_64')
url="http://www.pdal.io"
license=('BSD')
depends=('gdal' 'libgeotiff' 'jsoncpp' 'libunwind')
makedepends=('cmake' 'python' 'python-numpy' 'ninja' 'postgresql-libs')
optdepends=('python-numpy: for the Python plugin'
            'sqlite: for the sqlite plugin'
            'postgresql-libs: for the postgresql plugin')
provides=('pdal')
source=("https://github.com/PDAL/PDAL/releases/download/${pkgver}/PDAL-${pkgver}-src.tar.bz2")
sha512sums=('f67a303711b7d9e9dc14260afb96d299bcd5327ba0cc947143a583f55bd532a248b131e4602fd37d711ad0084e8601420828dacac40c414b95b8e9f9e8175e1b')

build() {
  cd "PDAL-$pkgver-src/"

  cmake \
      -Bbuild \
      -GNinja \
      -DCMAKE_INSTALL_PREFIX=/usr \
      -DBUILD_PLUGIN_PGPOINTCLOUD=ON \
      -DWITH_COMPLETION=ON

  ninja -C build
}

package() {
  cd "PDAL-$pkgver-src"

  DESTDIR="$pkgdir/" ninja -C build install

  install -Dm644 LICENSE.txt "${pkgdir}"/usr/share/licenses/$pkgname/LICENSE
}
